<template>
  <div>
    <h2>Vue Router Demo</h2>
    <button @click = "stepback">后退</button>
    <button @click = "forward">前进</button>
    <button @click = "go">跳转</button>
  </div>
</template>

<script>
  export default {
      name: "Banner",
      methods:{
        stepback(){
          this.$router.back(); //注意路由器router全局只有一个，路由的配置信息放在VueRouter的缔造者原型上，而route每个组件都是独立的
        },
        forward(){
          this.$router.forward()
        },
        go(){
          this.$router.go(2)  //可前进也可后退，参数为正数时前进，负数时后退
        }
      }
  }
</script>

<style>

</style>